#ifndef __FORMAT_ID_DEFINE__
#define __FORMAT_ID_DEFINE__

#include "archive.h"

namespace xm
{
	DEFINE_PROGID(KFormats);

	typedef UINT32	FMTID;

	enum FileType
	{
		FMT_NONE,
		FMT_PE,
		FMT_SWX,
		FMT_PDF,
		FMT_DOC,
		FMT_RTF,
		FMT_DEX,
		FMT_JCLS,
		FMT_TIFF,
		FMT_XDP,
		FMT_ELF,
	};

	typedef struct _FMTDESC
	{
		FileType	TypeId;
		LPCSTR		TypeName;
	} FMTDESC, *LPFMTDESC;

	class IKFormats : public IUnknown
	{
	public:
		STDMETHOD(Push)( FileType type, xv::AnyValue * addv = 0 ) PURE;
		// newType == FMT_NONE, remove oldType
		STDMETHOD(Replace)( FileType oldType, FileType newType, xv::AnyValue * addv = 0 ) PURE;
		STDMETHOD_(FileType,GetAt)( SIZE_T i, xv::AnyValue * pval = 0 ) PURE;
		STDMETHOD_(FileType,Find)( FileType type, xv::AnyValue * pval = 0 ) PURE;
		STDMETHOD_(SIZE_T,Count)() PURE;
		STDMETHOD(Clear)() PURE;
		DECLARE_IID;
	};

	// {102F0B92-D00D-401F-8D09-1C5A9F2C42AF}
	DEFINE_IID( IKFormats, "{102F0B92-D00D-401F-8D09-1C5A9F2C42AF}",
		0x102f0b92, 0xd00d, 0x401f, 0x8d, 0x9, 0x1c, 0x5a, 0x9f, 0x2c, 0x42, 0xaf);

	FMTDESC * WINAPI FormatGetByIndex( SIZE_T uIndex );
	FMTDESC * WINAPI FormatQueryById( FileType TypeId );
	FMTDESC * WINAPI XmFormatFromName( LPCSTR aName );
	HRESULT	  WINAPI XmFormatDiscern( IKBStream * pstm, IKFormats * formats );

};


#endif